home *** CD-ROM | disk | FTP | other *** search
-
-
-
- iiiillllSSSSeeeemmmmaaaapppphhhhoooorrrreeee((((3333)))) IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll iiiillllSSSSeeeemmmmaaaapppphhhhoooorrrreeee((((3333))))
-
-
-
- NNNNAAAAMMMMEEEE
- iiiillllSSSSeeeemmmmaaaapppphhhhoooorrrreeee - provides semaphore services
-
- IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
- This is a base class and therefore has no inheritance.
-
- HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
- #include <il/ilSemaphore.h>
-
- CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- This class is an interface to the user-mode semaphore services and
- provides tools for synchronizing access to shared resources. One can use
- ilSemaphore to coordinate the way parallel threads of execution access
- shared memory and other shared resources.
-
- Semaphores take a nonnegative integer value. A positive semaphore value
- corresponds to a free lock in that it does not obstruct the continued
- execution of a thread. A zero-valued semaphore corresponds to a set lock
- in that it suspends or blocks the continued execution of a thread. The
- thread remains blocked until another thread increments the semaphore
- counter value.
-
- To use _i_l_S_e_m_a_p_h_o_r_e to control access to shared resources, the threads
- should "get" a semaphore before using the resource. To get a semaphore,
- one can use the ddddeeeecccc(((()))) function or the -- operator, both of which
- decrement the semaphore counter (perform a P operation). If the semaphore
- counter was positive before the P operation, the thread uses the
- resource. When the thread is done with the resource, one can use the
- _i_n_c() function or the ++ operator to increment (perform V operation) the
- semaphore counter.
-
- If the value of the semaphore counter is zero when the P operation is
- attempted, the system suspends the thread until the semaphore counter is
- incremented by another thread performing a V operation.
-
- The semaphore count can be interpreted in the following way: if it is
- greater than zero, there are that many resources available, namely that
- many processes can use the _d_e_c() function and not block. An allocated
- semaphore is freed when the destructor is invoked.
-
- CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
- CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
-
- ilSemaphore(int val=1)
-
- SSSSeeeemmmmaaaapppphhhhoooorrrreeee sssseeeerrrrvvvviiiicccceeeessss
-
- int dec(int wait=TRUE)
- int inc()
- int operator=(int val)
- int operator++()
- int operator--()
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- iiiillllSSSSeeeemmmmaaaapppphhhhoooorrrreeee((((3333)))) IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll iiiillllSSSSeeeemmmmaaaapppphhhhoooorrrreeee((((3333))))
-
-
-
- int set(int val)
-
-
- FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
- iiiillllSSSSeeeemmmmaaaapppphhhhoooorrrreeee(((())))
-
- ilSemaphore(int val=1)
-
-
- The constructor allocates a semaphore and initializes its count to
- the value specified by _v_a_l. The semaphore that is allocated is a
- blocking semaphore - if the semaphore is unavailable, the caller
- blocks.
-
- A _v_a_l of 0 implies no available resources, and the first process
- that attempts a P operation (by _d_e_c() or --) blocks. This can be
- viewed as a synchronizing semaphore, since the goal is to always
- have a process block until another has completed an operation that
- the first process requires. Positive values for _v_a_l can be used for
- tracking a collection of resources. The simplest case of a value of
- 1 implements the common mutual exclusion semaphore, where one and
- only one process is permitted through a semaphore at a time. Values
- greater than one imply that up to _v_a_l resources can be
- simultaneously used, but requests for more than _v_a_l resources cause
- the calling process to block until a resource comes free (by a
- process holding a resource performing an _i_n_c() or ++).
-
- The _i_l_S_e_m_a_p_h_o_r_e instantiation fails if there is no memory available
- to allocate the _i_l_S_e_m_a_p_h_o_r_e object or if _v_a_l is less than zero or
- greater than 30000; in this case the program will be killed with an
- assertion failure.
-
- ddddeeeecccc(((())))
-
- int dec(int wait=TRUE)
-
-
- If _w_a_i_t is TRUE, this function performs a simple P operation on the
- semaphore, blocking if necessary, and returns only when the calling
- thread has acquired the semaphore. If _w_a_i_t is FALSE, the semaphore
- is acquired if currently free; otherwise, zero is immediately
- returned. Upon successful completion, a 1 is returned. A zero is
- returned for platforms that do not support multiprocessing.
-
- iiiinnnncccc(((())))
-
- int inc()
-
-
- This function performs a simple V operation, that is, it increments
- the value of the semaphore. The first process (if any) waiting for
- the semaphore is awakened. Upon successful completion, a 1 is
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- iiiillllSSSSeeeemmmmaaaapppphhhhoooorrrreeee((((3333)))) IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll iiiillllSSSSeeeemmmmaaaapppphhhhoooorrrreeee((((3333))))
-
-
-
- returned. A zero is returned for platforms that do not support
- multiprocessing.
-
- ooooppppeeeerrrraaaattttoooorrrr ====
-
- int operator=(int val)
-
-
- This convenience operator performs the same function as the _s_e_t()
- function described below, that is, it initialize the semaphore, with
- the count of the semaphore set to _v_a_l. A value of zero is returned
- on successful completion.
-
- ooooppppeeeerrrraaaattttoooorrrr ++++++++
-
- int operator++()
-
-
- This convenience operator performs the same function as the _i_n_c()
- function described above, that is, it increments the value of the
- semaphore.
-
- ooooppppeeeerrrraaaattttoooorrrr --------
-
- int operator--()
-
-
- This convenience operator performs the same function as the _d_e_c()
- function described above, with _w_a_i_t set to TRUE.
-
- sssseeeetttt(((())))
-
- int set(int val)
-
-
- This function initializes the semaphore and the count of the
- semaphore is set to _v_a_l. For more information on _v_a_l, see the
- constructor description above. The initialization fails if _v_a_l is
- less than zero or greater than 30000. A zero is returned on
- successful completion. A zero is also returned if the platform does
- not support multiprocessing.
-
- NNNNOOOOTTTTEEEESSSS
- Refer to the _I_m_a_g_e_V_i_s_i_o_n _L_i_b_a_r_y _P_r_o_g_r_a_m_m_i_n_g _G_u_i_d_e for more details.
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-